# -*- coding:utf-8 -*-
# @author='dapeng',
# @version='1.0.0'

import random
import os

path="D:/meizitu/images"
paths = os.listdir(path)



#随机返回本地妹子图图片
def randomImg():
    sum = 0
    for p in paths:
        sum = sum + len(os.listdir(path+('/')+p))
    x = random.randint(0, sum-1)
    for parent,dirnames,filenames in os.walk(path):  #三个参数：分别返回1.父目录 2.所有文件夹名字（不含路径） 3.所有文件名字
        for filename in filenames:
            if (x==0):
                finame =os.path.join(parent,filename).replace('\\', '/')
                print(finame)
                return finame
            x = x -1
